125 FOR A = 1 TO 3: FOR B = 1 TO 3:A(A,B) = 0: NEXT B,A
130 HTAB 8: PRINT " APPLE II TIC-TAC TOE "
140 PRINT : PRINT : PRINT " IN THIS GAME YOU ENTER YOUR MOVES AS": PRINT : PRINT "AN X CO-ORDINATE AND A Y CO-ORDINATE": PRINT : PRINT "BETWEEN 1 AND 3. E.G.(1,1; 2,2; 3,3)"
150 PRINT : PRINT : PRINT : GET A$: GET A$: GET A$
190 HOME : VTAB 5
200 PRINT "DO YOU WANT TO PLAY AGAINST THE": PRINT : PRINT "COMPUTER OR WOULD YOU LIKE TO PLAY": PRINT : PRINT "AGAINST A SECOND PERSON ('C' FOR": PRINT : PRINT "COMPUTER AND 'P' FOR A SECOND PERSON)"
220 PRINT : GET A$
225 IF A$ = "<CTRL-C>" THEN END : REM CTL C
230 IF LEFT$(A$,1) = "P" THEN 20000
240 IF LEFT$(A$,1) < >"C" THEN 190
250 TEXT : HOME : VTAB 5: PRINT " YOU ARE NOW PLAYING AGAINST THE": PRINT : PRINT "COMPUTER IN A GAME OF TIC-TAC TOE"
260 GOSUB 20030
270 HOME : VTAB 5: PRINT " YOU ARE 'X', I, THE COMPUTER": PRINT : PRINT "AM THE 'O'": PRINT : PRINT : GET A$: GET A$
457 PRINT "I ALL READY HAVE THAT SQUARE": PRINT : PRINT : GOTO 300
460 PRINT "YOU ALL READY HAVE THAT SQUARE": PRINT : PRINT : GOTO 300
470 A(X,Y) = 1
475 HOME
480 GOSUB 5000
490 GOSUB 10000
495 VTAB 13
500 PRINT "NOW IT'S MY TURN"
505 REM COMP. TURN<CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-E><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G>
510 IF ABS(A(2,1) +A(3,1)) = 2 THEN A = 1
520 IF ABS(A(1,2) +A(1,3)) = 2 THEN A = 1
530 IF ABS(A(2,1) +A(3,1)) = 2 THEN A = 1
540 IF ABS(A(1,1) +A(3,1)) = 2 THEN A = 2
550 IF ABS(A(2,2) +A(2,3)) = 2 THEN A = 2
560 IF ABS(A(1,1) +A(2,1)) = 2 THEN A = 3
570 IF ABS(A(3,2) +A(3,3)) = 2 THEN A = 3
580 IF ABS(A(1,3) +A(2,2)) = 2 THEN A = 3
590 IF ABS(A(1,1) +A(1,3)) = 2 THEN A = 4
600 IF ABS(A(2,2) +A(3,1)) = 2 THEN A = 4
610 IF ABS(A(1,2) +A(3,2)) = 2 THEN A = 5
620 IF ABS(A(2,1) +A(2,3)) = 2 THEN A = 5
630 IF ABS(A(1,3) +A(3,1)) = 2 THEN A = 5
640 IF ABS(A(1,1) +A(3,3)) = 2 THEN A = 5
650 IF ABS(A(3,1) +A(3,3)) = 2 THEN A = 6
660 IF ABS(A(1,2) +A(2,2)) = 2 THEN A = 6
670 IF ABS(A(1,1) +A(1,2)) = 2 THEN A = 7
680 IF ABS(A(2,3) +A(3,3)) = 2 THEN A = 7
690 IF ABS(A(3,1) +A(2,2)) = 2 THEN A = 7
700 IF ABS(A(2,1) +A(2,2)) = 2 THEN A = 8
710 IF ABS(A(1,3) +A(3,3)) = 2 THEN A = 8
720 IF ABS(A(3,1) +A(3,2)) = 2 THEN A = 9
730 IF ABS(A(1,1) +A(2,2)) = 2 THEN A = 9
740 IF ABS(A(1,3) +A(2,3)) = 2 THEN A = 9
750 IF A = 0 THEN 1000
780 ON A GOSUB 790,795,800,805,810,815,820,825,830
783 IF A(A,B) = -1 OR A(A,B) = 1 THEN 1000
785 A(A,B) = -1: GOTO 900
790 A = 1:B = 1: RETURN
795 A = 2:B = 1: RETURN
800 A = 3:B = 1: RETURN
805 A = 1:B = 2: RETURN
810 A = 2:B = 2: RETURN
815 A = 3:B = 2: RETURN
820 A = 1:B = 3: RETURN
825 A = 2:B = 3: RETURN
830 A = 3:B = 3: RETURN
900 PRINT : PRINT : PRINT "MY MOVE IS ... ";: FOR I = 1 TO 1000: NEXT I: PRINT A;", ";B: PRINT : PRINT : PRINT : FOR I = 1 TO 2000: NEXT I: GOSUB 5000: GOSUB 10000: GOTO 290
999 STOP : REM <CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G>
1000 A = INT( RND(1) *3) +1
1010 B = INT( RND(1) *3) +1
1020 IF A(A,B) = 1 THEN 1000
1030 IF A(A,B) = -1 THEN 1000
1040 A(A,B) = -1
1050 GOTO 900
1999 STOP
5000 REM DISPLAY 'BOX'
5005 TEXT
5010 POKE 34,11
5020 A$(1) = "O"
5030 A$(2) = " "
5040 A$(3) = "X"
5050 FOR J = 6 TO 8 STEP 2
5055 VTAB J
5060 FOR I = 12 TO 30
5070 HTAB I
5080 PRINT "-";: NEXT I
5090 NEXT J
5095 VTAB 3
5100 FOR I = 1 TO 3
5110 HTAB I *6 +9
5120 PRINT I;
5130 NEXT I
5140 FOR J = 4 TO 10
5145 VTAB J
5150 FOR I = 18 TO 24 STEP 6
5160 HTAB I
5170 PRINT "!";
5180 NEXT I,J
5200 FOR I = 1 TO 3
5220 VTAB I *2 +3
5230 HTAB 10
5240 PRINT I: NEXT I
5250 FOR A = 1 TO 3
5260 FOR B = 1 TO 3
5270 VTAB B *2 +3
5280 HTAB A *6 +9
5290 PRINT A$(A(A,B) +2)
5300 NEXT B,A
5305 INVERSE
5310 VTAB 7: HTAB 4: PRINT " Y "
5320 VTAB 1: HTAB 20: PRINT " X "
5330 NORMAL
6000 RETURN
6280 HTAB A *6 +9
6290 PRINT A$(A(A,B) +2)
6300 NEXT B,A
10000 REM CHECK FOR WIN !!<CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G>
10025 Z = 0
10030 FOR I = 1 TO 3
10035 Z = 0
10040 FOR J = 1 TO 3
10050 Z = Z +A(I,J)
10070 NEXT J
10080 IF Z = 3 OR Z = -3 THEN 11000
10090 NEXT I
10100 FOR J = 1 TO 3
10105 Z = 0
10110 FOR I = 1 TO 3
10120 Z = Z +A(I,J)
10140 NEXT I
10150 IF Z = 3 OR Z = -3 THEN 11000
10160 NEXT J
10170 Z = 0
10200 FOR I = 1 TO 3
10210 Z = Z +A(I,I)
10230 NEXT I
10240 IF Z = 3 OR Z = -3 THEN 11000
10250 Z = 0
10300 FOR I = 1 TO 3
10320 Z = Z +A(I,4 -I)
10340 NEXT I
10350 IF Z = 3 OR Z = -3 THEN 11000
10355 Z = 0
10360 FOR I = 1 TO 3
10365 FOR J = 1 TO 3
10370 Y = A(I,J):Y = ABS(Y)
10375 Z = Z +Y
10380 NEXT J,I
10390 IF Z = 9 THEN 12000
10400 RETURN
11000 REM SOMEONE WON !!<CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G>
11005 POP : FOR I = 1 TO 2000: NEXT I: IF Z = 3 THEN A$ = " YOU"
11010 IF Z = -3 THEN A$ = " I"
11015 IF ABS(Z) < >3 THEN STOP
11020 IF Z = 3 AND VERSN = 2 THEN A$ = PLAYER$(2)
11025 IF Z = -3 AND VERSN = 2 THEN A$ = PLAYER$(1)
11030 TEXT : HOME : VTAB 9
11040 PRINT " TIC-TAC TOE, ";A$;" WON THE GAME !"
11050 VTAB 12: PRINT "DO YOU WANT TO PLAY ANOTHER GAME (Y/N)";
11055 GET A$
11060 IF A$ = "N" THEN END
11065 PRINT
11070 IF A$ < >"Y" THEN 11050
11080 GOTO 100
12000 TEXT : HOME : VTAB 5
12003 POP : IF Z = 3 THEN STOP
12005 FOR I = 1 TO 2000: NEXT I
12010 PRINT " IT'S A TIE GAME ..."
12020 GOTO 11050
20000 TEXT : HOME : VTAB 5
20010 HTAB 1
20020 PRINT " YOU ARE NOW PLAYING THE TWO PERSON": PRINT : PRINT "VERSION OF TIC-TAC TOE"
20025 GOSUB 20030: GOTO 20100
20030 PRINT : PRINT : PRINT
20040 PRINT "DO YOU WANT TO PLAY THIS VERSION (Y/N)";: GET A$
20050 IF A$ = "N" THEN POP
20053 IF A$ = "N" THEN 190
20054 IF A$ = "N" THEN GOTO 190
20055 PRINT
20060 IF A$ < >"Y" THEN 20040
20070 RETURN
20100 REM PERSON VERSION<CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G><CTRL-G>
20110 TEXT : HOME : VTAB 5
20115 VERSN = 2
20120 FOR I = 1 TO 2
20130 PRINT " WHAT IS PLAYER #";I;
20140 INPUT "'S NAME ?";PLAYER$(I)
20150 PRINT : PRINT "PLY #";I;" IS ";PLAYER$(I);". CORRECT (Y/N) ";: GET A$: PRINT : PRINT
20160 IF A$ = "N" THEN 20130
20170 IF A$ < >"Y" THEN 20150
20180 PRINT : PRINT : PRINT : PRINT : NEXT I
20200 FOR PLAYER = -1 TO 1 STEP 2
20205 HOME : GOSUB 5000
20210 VTAB 13
20213 IF PLAYER = -1 THEN Y = 1
20215 IF PLAYER = -1 THEN K = 1
20217 IF PLAYER = 1 THEN K = 2
20218 IF PLAYER = 1 THEN Y = 3
20220 PRINT "IT IS ";PLAYER$(K);"'S TURN (";A$(Y);")"
20230 PRINT
20240 INPUT " WHAT IS YOUR MOVE (AS X,Y) ";X,Y
20245 PRINT : PRINT : PRINT PLAYER$(K);"'S MOVE IS ";X;", ";Y;". CORRECT (Y/N) ";: GET A$
20247 IF A$ = "N" THEN 20230: IF A$ < >"Y" THEN 20245
20250 IF X <1 OR X >3 OR Y <1 OR Y >3 THEN 20205
20260 IF ABS(A(X,Y)) = 1 THEN 20280
20270 GOTO 20300
20280 PRINT : PRINT "THAT SQUARE IS TAKEN ..."
20290 GOTO 20213
20300 A(X,Y) = PLAYER
20310 GOSUB 5000: GOSUB 10000
20320 NEXT PLAYER
20330 GOTO 20200
25900 REM <CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H> <CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H><CTRL-H>FROM: APPLE-CAN<CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J><CTRL-J>